﻿<Application x:Class="Enterprise_Store.DataBinding"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Startup="AppStartup"
    xmlns:src="clr-namespace:Enterprise_Store" 
    xmlns:System="clr-namespace:System;assembly=Mscorlib"
    >
    <Application.Resources>
        
      <Style x:Key="titleStyle" TargetType="TextBlock">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="DodgerBlue"/>
        <Setter Property="FontSize" Value="18"/>
      </Style>

      <Style x:Key="smallTitleStyle" TargetType="TextBlock">
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Foreground" Value="DimGray"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
      </Style>

      <Style x:Key="textStyleTextBlock" TargetType="TextBlock">
        <Setter Property="Foreground" Value="#333333" />
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>

      <Style x:Key="textStyleTextBox" TargetType="TextBox">
        <Setter Property="Foreground" Value="#333333" />
        <Setter Property="MaxLength" Value="40" />
        <Setter Property="Width" Value="392" />
        <Style.Triggers>
          <Trigger Property="Validation.HasError" Value="true">
            <Setter Property="ToolTip"
              Value="{Binding RelativeSource={RelativeSource Self},
                              Path=(Validation.Errors)[0].ErrorContent}"/>
          </Trigger>
        </Style.Triggers>
      </Style>
      <Style x:Key="comboBoxItemStyle" TargetType="ComboBoxItem">
        <Setter Property="Foreground" Value="#333333" />
      </Style>

      <Style x:Key="comboBoxStyle" TargetType="ComboBox">
        <Setter Property="Foreground" Value="#333333" />
      </Style>
      
        <DataTemplate DataType="{x:Type src:AppPackage}">
            <Border BorderThickness="1" BorderBrush="Gray"
                    Padding="7" Name="border" Margin="3" Width="300">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="5"/>
                        <ColumnDefinition Width="80"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                      
                    <TextBlock Grid.Row="0" Grid.Column="1" Margin="0,0,8,0"
                                Name="descriptionTitle"
                                Style="{StaticResource smallTitleStyle}">Package:</TextBlock>
                    <TextBlock Name="DescriptionDTDataType" Grid.Row="0" Grid.Column="2" 
                        Text="{Binding Path=Name}" 
                        Style="{StaticResource textStyleTextBlock}"/>

                    <TextBlock Grid.Row="1" Grid.Column="1" Margin="0,0,8,0"
                                Name="appTitleLbl"
                                Style="{StaticResource smallTitleStyle}">First App Name:</TextBlock>
                    <TextBlock Name="appTitle" Grid.Row="1" Grid.Column="2" 
                        Text="{Binding Path=FirstAppName}" 
                        Style="{StaticResource textStyleTextBlock}"/>


                    <TextBlock Grid.Row="2" Grid.Column="1" Margin="0,0,8,0"
                                Name="currentPriceTitle"
                                Style="{StaticResource smallTitleStyle}">Version:</TextBlock>
                    <StackPanel Grid.Row="2" Grid.Column="2" Orientation="Horizontal">
                        <TextBlock Name="CurrentPriceDTDataType" 
                            Text="{Binding Path=Version}" 
                            Style="{StaticResource textStyleTextBlock}"/>
                    </StackPanel>
                </Grid>
            </Border>
        </DataTemplate>

        <DataTemplate DataType="{x:Type src:App}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="{Binding Path=Id}"/>
                <TextBlock Grid.Column="1" Text=" - "/>
                <TextBlock Grid.Column="2" Text="{Binding Path=Name}"/>

            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="detailsProductListingTemplate">
            <Grid Margin="2,5,2,10">
              <Grid.RowDefinitions>
                <RowDefinition Height="70"/>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="70"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="100"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="40"/>
                </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
              </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,8,0"
                           Name="typeOfApplbl"
                           Style="{StaticResource smallTitleStyle}">Type of application:</TextBlock>
                <ListBox Name="typeOfApp" Grid.Row="0" Grid.Column="1" 
                    SelectedIndex="{Binding Path=TypeOfLink}" Height="60" SelectionChanged="typeOfApp_SelectionChanged_1" >
                    <ListBoxItem>Internal Win8 app</ListBoxItem>
                    <ListBoxItem>Windows Store app</ListBoxItem>
                    <ListBoxItem>Windows Desktop app</ListBoxItem>
                </ListBox>


                <TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,8,0"
                           Name="packageNamelbl"
                           Style="{StaticResource smallTitleStyle}">Package name:</TextBlock>
                <TextBlock Name="packageName" Grid.Row="1" Grid.Column="1" 
                    Text="{Binding Path=Name}" 
                    Style="{StaticResource textStyleTextBlock}"/>
                
                <TextBlock Grid.Row="2" Grid.Column="0" Margin="0,0,8,0"
                           Name="appIDlbl"
                           Style="{StaticResource smallTitleStyle}">Select application:</TextBlock>
                <ListBox Name="appID" Grid.Row="2" Grid.Column="1" 
                    ItemsSource="{Binding Path=AppList}" SelectedIndex="{Binding Path=AppID}" Height="60" />
                
                <TextBlock Grid.Row="3" Grid.Column="0" Margin="0,0,8,0"
                           Name="displayedNamelbl"
                           Style="{StaticResource smallTitleStyle}">Displayed name:</TextBlock>
                <TextBox Name="displayedName" Grid.Row="3" Grid.Column="1" Height="30" Text="{Binding Path=DisplayedName}"
                    />

                <TextBlock Grid.Row="4" Grid.Column="0" Margin="0,0,8,0"
                           Name="shortDesclbl"
                           Style="{StaticResource smallTitleStyle}">Short Description:</TextBlock>
                <TextBox Name="shortDesc" Grid.Row="4" Grid.Column="1" Height="30" Text="{Binding Path=ShortDesc}"
                    />

                <Grid Grid.Row="5" Grid.ColumnSpan="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="20"/>
                    </Grid.RowDefinitions>
                
                    <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,8,0"
                               Name="logoLbl"
                               Style="{StaticResource smallTitleStyle}">Logo path:</TextBlock>
                    <TextBox Name="logo" Grid.Row="0" Grid.Column="1" Height="30" Text="{Binding Path=Logo}"
                        />

                    <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,8,0"
                               Name="logoDesc1Lbl" FontSize="10" TextWrapping="Wrap" >File name only (example.png): logo embedded in the app</TextBlock>
                    <TextBlock Grid.Row="2" Grid.ColumnSpan="2" Margin="0,0,8,0"
                               Name="logoDesc2Lbl" FontSize="10" TextWrapping="Wrap">local\File name (local\example.png): logo embedded in the user profile</TextBlock>
                    <TextBlock Grid.Row="3" Grid.ColumnSpan="2" Margin="0,0,8,0"
                               Name="logoDesc3Lbl" FontSize="10" TextWrapping="Wrap">Path to file (http://server/site/logo.jpg): logo stored elsewhere</TextBlock>
                </Grid>
                
                
                <TextBlock Grid.Row="6" Grid.Column="0" Margin="0,0,8,0"
                           Name="appPathlbl"
                           Style="{StaticResource smallTitleStyle}">Path to appx:</TextBlock>
                <TextBox Name="appPath" Grid.Row="6" Grid.Column="1" Height="30" 
                    Text="{Binding Path=Path}" />
                <TextBlock Grid.Row="7" Grid.ColumnSpan="2" Margin="0,0,8,0"
                               Name="pathDescLbl" FontSize="10" TextWrapping="Wrap">Only for internal Windows 8 apps</TextBlock>
                
                <TextBlock Grid.Row="8" Grid.Column="0" Margin="0,0,8,0"
                           Name="appCmdLlbl"
                           Style="{StaticResource smallTitleStyle}">Command line:</TextBlock>
                <TextBox Name="appCmdL" Grid.Row="8" Grid.Column="1" Height="30" 
                    Text="{Binding Path=CommandLine}" />
                <TextBlock Grid.Row="9" Grid.ColumnSpan="2" Margin="0,0,8,0"
                               Name="cmdDescLbl" FontSize="10" TextWrapping="Wrap">Only for Windows Desktop apps</TextBlock>

                <TextBlock Name="deepLinklbl" Grid.Row="10" Grid.Column="0" Margin="0,0,8,0"
                           Style="{StaticResource smallTitleStyle}">Deep linking:</TextBlock>
                <CheckBox Grid.Row="10" Grid.Column="1" Margin="0,0,8,0"
                               Name="deepLinkChk" IsChecked="{Binding Path=IsDeepLink}" />


            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="xmlViewOfCurrentApp">
            <TextBlock Name="ApplicationXmlCtrl"  Text="{Binding Xml}" TextWrapping="Wrap"  />
        </DataTemplate>
        
    </Application.Resources>
</Application>
